home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 April
/
Macworld (1999-04).dmg
/
Shareware World
/
Comms & Internet
/
WebSentinel 2.0.5
/
Extras
/
Scripting
/
WebSiphon
/
sentinel_example.t
next >
Wrap
Text File
|
1998-08-25
|
3KB
|
89 lines
<<
// Example template for interacting with WebSentinel
// Last modified: 8/25/1998
// This simple example uses the functions defined in "sentinel_functions.t"
// to communicate with WebSentinel. Specifically, it duplicates the
// "Lookup User" feature of WebSentinel Admin but in a web-based interface.
// Although this feature is now an option in the WebSentinel 2.0 web-based
// administration interface, this example may still be useful for understanding
// how WebSentinel scripting works, and can be modified to build other custom
// administration applications.
// This example only uses a small number of the functions available when
// communicating with WebSentinel. See the Scripting folder of the
// WebSentinel distribution for a complete list and description. If you
// have WebSentinel specific questions, you can also email
// <websentinel-support@purity.com>.
include "sentinel_functions.t";
// There are two possible actions that we can take in this template.
// First, if no variables are defined, we present a simple HTML form.
// Otherwise, if the "target_id" variable is defined, we know the user
// submitted the form and we use sentinel_LookupUser to find the user.
// Then, if the user is found, we redirect to the web-based admin of
// WebSentinel to modify the user's information.
if !defined (target_id)
// start off with some HTML for the page
<<
<HTML>
<HEAD><TITLE>WebSentinel Lookup Example</TITLE>
<BODY>
<FORM METHOD="GET" ACTION="sentinel_example.t">
<P>Target:
<SELECT NAME="target_id" SIZE="1">
>>
// get a list of targets to build the popup menu
my_targets = sentinel_GetTargets();
repeat with one_target in my_targets
<<
<OPTION VALUE="{one_target'1}">{one_target'2}
>>
end repeat;
// finish off the HTML
<<
</SELECT>
<P>Username to lookup:
<INPUT TYPE="TEXT" NAME="user" SIZE=30>
<P>
<INPUT TYPE="SUBMIT" VALUE=" Lookup User ">
</FORM>
</BODY>
</HTML>
>>
else
// find the user
user_id = sentinel_LookupUser (user, target_id);
// if the user_id is 0, the user didn't exist
if user_id = 0
<<
<HTML>
<HEAD><TITLE>WebSentinel Lookup Example</TITLE>
<BODY>
<P>Sorry, the user {user} didn't exist.
</BODY>
</HTML>
>>
else
// the user was found, so now redirect to WebSentinel's web-based admin
// (note, redirect's really should have the full URL, includding the host name)
redirectClient ("/pi_admin.sentinel$modifyuser_form?target_id=" & target_id & "&user_id=" & user_id);
end if;
end if;
>>